fix(nrl-scoreboard): match favorite/exclude teams by ESPN team ID, not abbreviation#189
fix(nrl-scoreboard): match favorite/exclude teams by ESPN team ID, not abbreviation#189ChuckBuilds wants to merge 2 commits into
Conversation
…t abbreviation NRL's ESPN abbreviations aren't unique — "NEW" is both Newcastle Knights and New Zealand Warriors, "CAN" is both Canberra Raiders and Canterbury Bulldogs. Matching favorite_teams/exclude_teams by abbreviation silently conflated these teams. DynamicTeamResolver now resolves configured team names/IDs to unique ESPN team IDs (fetching the NRL team list, with a name/ID lookup and an explicit warning on ambiguous or unresolved abbreviations), and every favorite/exclude membership check in sports.py and manager.py now compares against home_id/away_id instead of home_abbr/away_abbr. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rxy8kp5foWywPeBsCmY1Uo
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The plugin safety harness (LEDMatrix core's check_plugin.py) expects mock_data in test/harness.json to be a path string to a fixture file, not inline JSON - it does Path(plugin_dir) / mock_data, which raises TypeError against a dict. Every other plugin harness in this repo follows the path convention (e.g. ledmatrix-weather's test/fixtures/mock.json); this plugin's harness.json had the ESPN response inlined instead, which was failing the "safety" CI check on both this PR and #182. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rxy8kp5foWywPeBsCmY1Uo
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 35 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Summary
Fixes a bug reported by a user testing PR #182 (NRL scoreboard):
ESPN's rugby-league team abbreviations are not unique:
NEWis used by both the Newcastle Knights and the New Zealand Warriors, andCANis used by both the Canberra Raiders and the Canterbury Bulldogs.favorite_teams/exclude_teamsmatching previously compared againsthome_abbr/away_abbr, so configuring one of these abbreviations silently matched both teams.Fix
dynamic_team_resolver.py:DynamicTeamResolvernow fetches the NRL team list from ESPN once (in-process cache, 24h TTL) and resolves each configuredfavorite_teams/exclude_teamsentry to a unique ESPN team ID:NEW,CAN) is not silently resolved to either team — it logs an error naming both candidate teams and instructs the user to use the full team name or ID instead.sports.py/manager.py: every favorite/exclude membership check now compareshome_id/away_id(already extracted per-game) against the resolved team-ID list, instead ofhome_abbr/away_abbr. This covers live rotation filtering/classification, live-priority weighting, goal/win celebrations, and upcoming/recent game selection and filtering.config_schema.json/README.md: updated descriptions to steer users toward full team names or ESPN team IDs, with theNEW/CANcollision called out explicitly.test/harness.json:favorite_teamsswitched from["PEN", "BRI"]to the corresponding team IDs (["18", "16"]) so the offline test harness doesn't depend on a live network fetch to resolve favorites.test_nrl_plugin.py: addedTestDynamicTeamResolverAbbreviationCollisionscovering the ambiguous-abbreviation case, full-name disambiguation, unique-abbreviation resolution, numeric ID passthrough, and fetch-failure fallback (mocksrequests.get, no network needed).Test plan
python3 -m py_compileall touched.pyfiles — passes.python3 test_nrl_plugin.py— 11/11 tests pass (6 pre-existing + 5 new).manifest.json,config_schema.json,test/harness.jsonall parse.python scripts/check_module_collisions.py— no cross-plugin collisions.python update_registry.py— registry synced, version bumped to 1.0.1.check_plugin.pycross-size harness (requires a LEDMatrix core checkout — none available in this environment).site.api.espn.com).🤖 Generated with Claude Code
Generated by Claude Code